function course(tbl){
	if(isEmpty(tbl.id)){
		return ">>:pay/orders/id/1";
	}
	var course=$fetch("course",Cnd.where("id","=",tbl.id))
	var o=$fetch("orders",Cnd.where("tbl_id","=",tbl.id).and("tbl_name","=","course").and("user_id","=",user().id));
	if(o!=null){
		if(o.status==1){
			attr("order",o)
			return ">>:pay/applysuccess/id/"+o.id
		}else{
			attr("order",o)
			return ">>:pay/order/id/"+o.id;
		}
	}
	var order=new Record();
	order.put(".table","orders")
	var oid=uuid();
	order.put("id",oid);
	var OrderNo=Java.type("com.jse.util.OrderNo");
	order.put("tbl_name","course");
	order.put("tbl_id",tbl.id);
	order.put("title",course.title);
	order.put("img",course.img);
	order.put("agency_id",course.agency_id);
	order.put("agency_name",course.agency_name);
	if(!isEmpty(tbl.uid)){
		order.put("uid",tbl.uid);
		var u=dao.fetch("users",Cnd.where("id","=",tbl.uid))
			order.put("organ_id",u.organ_id);
		if(u.organ_id>0){
			order.put("divide",course.divide);
		}else{
			order.put("divide",course.divide/2);
		}
	}
	var no=OrderNo.getOrderNo();
	order.put("orderno", no);
	order.put("user_id",user().id);
	order.put("price",course.price); 
	order.put("total_price",course.price)
	order.put("content",course.title)
	order.put("text",course.title)
	var dat = new java.util.Date();
	order.put("add_time",dat)
	var dat = new java.util.Date();
	var cal = Calendar.getInstance();
	cal.setTime(dat);
	cal.add(Calendar.MONTH,1);//用Calendar对月加1,绕开判断闰年
	var end_time=cal.getTime();
	order.put("end_time", end_time);
	var ispay=false;
	if(course.type!="normal"){
		ispay=true;
	}else  if(course.vip>user().vip&&course.vip>1){
		print(2)
		ispay=true;
	}else if(course.price>0&&user().vip<1){
		print(3)
		ispay=true;
	}else if(course.price>0&&course.vip>0&&user().vip<2){
		print(4)
		ispay=true;
	}
	if(ispay){
		let mp=dao.select("select group_concat(course) as id from combo where id in (SELECT tbl_id from orders where user_id="+user().id+" and status=1 and tbl_name='combo' )"
				,new ArrayList())
				if(mp!=null&&mp.size()>0){
					if(!isEmpty(mp.get(0).id)){
					if(mp.get(0).id.indexOf(tbl.id) > -1 ){
						ispay=false;
					}}
				}
	}
	if(ispay){//收费
		$save(order);
		attr("order",order)
		return ">>:pay/order/id/"+oid;
	}else{
		//报名处理
		order.put("status",1)
		$save(order);
		attr("order",order)
		return ">>:pay/applysuccess/id/"+order.id
	}
}